package com.kb.design.mapper.postgreSQL;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kb.design.entity.BonusAllocation;
import com.kb.design.entity.DesignProject;
import com.kb.design.vo.chart.DeptPerformance;
import com.kb.design.vo.chart.MonthlyPerformanceVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * 奖金配置Mapper接口
 *
 * @author ruoyi
 */
@Mapper
public interface ChartMapper extends BaseMapper<BonusAllocation> {

    List<Map<String, Object>> getMonthlyPerformanceByUserCode(@Param("userCode") String userCode, @Param("year") String year);

    /**
     * 根据项目ID集合和 field0 查询 pin_num 的总和
     */
    Long sumPinNumByProjectIdAndField0(@Param("projectIds") List<Long> projectIds,
                                       @Param("field0") String field0);

    /**
     * 查询已经完结的项目
     */
    List<DesignProject> getCompletedProjects(@Param("start") LocalDate start, @Param("end") LocalDate end);

    List<DeptPerformance> getDeptPerformance(@Param("deptId") Long deptId, @Param("start") LocalDate start, @Param("end") LocalDate end);
    List<DeptPerformance> getDeptPagePerformance(@Param("deptId") Long deptId, @Param("start") LocalDate start, @Param("end") LocalDate end);

    List<DeptPerformance> getDeptPerformanceRanking(@Param("deptId") Long deptId, @Param("start") LocalDate start, @Param("end") LocalDate end);
    List<DeptPerformance> getDeptPagePerformanceRanking(@Param("deptId") Long deptId, @Param("start") LocalDate start, @Param("end") LocalDate end);

    List<DeptPerformance> getDeliveryDesignList(@Param("deptId") Long deptId, @Param("start") LocalDate start, @Param("end") LocalDate end);

    List<DeptPerformance> getBonusDistribution(@Param("deptId") Long deptId, @Param("start") LocalDate start, @Param("end") LocalDate end);

    List<DeptPerformance> getDeliveryPageList(@Param("deptId") Long deptId, @Param("start") LocalDate start, @Param("end") LocalDate end);

    DeptPerformance getDeptProjectNum(@Param("deptId") Long deptId, @Param("start") LocalDate start, @Param("end") LocalDate end);
    List<DesignProject> getProjectBy2Dept(@Param("deptId") Long deptId, @Param("status") String status);
    List<DesignProject> getPageProjectBy2Dept(@Param("deptId") Long deptId, @Param("status") String status);
}
